package com.jwds.digital.bios.business.core.infrastructure.mapper.belt;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwds.digital.bios.business.core.infrastructure.dto.belt.BeltRouteTaskMainReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.entity.belt.BeltRouteTaskMain;
import com.jwds.digital.bios.business.core.infrastructure.vo.belt.BeltRouteTargetHisRespVO;
import com.jwds.digital.bios.business.core.infrastructure.vo.belt.BeltRouteTaskMainRespVO;
import com.jwds.digital.bios.business.core.infrastructure.vo.belt.LineDataRespVo;
import com.jwds.digital.bios.business.core.infrastructure.vo.belt.tonPowerConsumptionRespVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 路线作业实绩主表 Mapper 接口
 *
 * @author 林柏云
 * @date 2024-11-28
 */
@Mapper
public interface BeltRouteTaskMainMapper extends BaseMapper<BeltRouteTaskMain> {

  /**
   * 分页查询
   * @param page 分页参数
   * @param condition 查询条件
   * @return respVOList 查询结果
   */
  IPage<BeltRouteTaskMainRespVO> pageQuery(@Param("page") Page<?> page, @Param("condition") BeltRouteTaskMainReqDTO condition);

  /**
  * 列表查询
  * @param condition 查询条件
  * @return respVOList 查询结果
  */
  List<BeltRouteTaskMainRespVO> queryList(@Param("condition") BeltRouteTaskMainReqDTO condition);

  /**
  * 根据ID查询
  * @param id 查询条件
  * @return respVO 查询结果
  */
  BeltRouteTaskMainRespVO queryById(@Param("id") Long id);


  /*******************扩展查询*******************/
  /**
   * 获取线路作业信息
   * @param dateTime 当前起始时间
   * @return 线路作业信息
   */
  List<BeltRouteTaskMainRespVO> getExecutiveJobInformation(@Param("dateTime") DateTime dateTime);

  BeltRouteTaskMainRespVO lineDataMessage(@Param("dateTime") DateTime dateTime, @Param("routeId") Long routeId);

  List<LineDataRespVo> lineRateData(@Param("dateTime") DateTime dateTime, @Param("routeId") Long routeId);

  BeltRouteTargetHisRespVO lineHistoryInformation(@Param("flowNo") Short flowNo);

  List<tonPowerConsumptionRespVO> tonPowerConsumption(@Param("dateTime") DateTime dateTime, @Param("routeId") Long routeId);

  Integer numberOfUnduplicatedTasks(@Param("flowNo") Short flowNo, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
}
